package TestMethod;

import java.util.Scanner;

//参数传递问题
public class MethodDemo6 {
    //交换方法
    public void swap(int a,int b){
        int temp;
        System.out.println("交换前:a="+a+" ,b="+b);
        temp=a;
        a=b;
        b=temp;
        System.out.println("交换后:a="+a+" ,b="+b);
    }
    public static void main(String[] args) {
        System.out.println("请输入要交换的两个数:");
        Scanner scanner=new Scanner(System.in);
        int m=scanner.nextInt();
        int n=scanner.nextInt();
        MethodDemo6 methodDemo6=new MethodDemo6();
        methodDemo6.swap(m,n);
    }
}
